function openSidebar() {
  $('.sidebar').show()
}
$(function () {
  $('.radius-tab').children('li').on('click',function () {
    $(this).addClass('active').siblings().removeClass('active')
  });
  var lineTab = $('.line-tab');
  lineTab.children('li').on('click',function () {
    var index = $(this).index();
    $(this).addClass('active').siblings().removeClass('active');
    lineTab.next('.line-box').children('section').eq(index).addClass('active').siblings().removeClass('active');
  });


  $('.sidebar-close').on('click',function (){
    $('.sidebar').hide()
  });

  //头部项目切换模拟 start
  function tabProClose(){
    $('.tab-project').hide();
    $('.header-text').removeClass('open')
  }
  $('.header-text').on('click',function (){
    if($(this).hasClass('open')){
      tabProClose()
    }else {
      $('.tab-project').show();
      $('.sidebar').hide();
      $('.header-text').addClass('open')
    }
  });
  $('.main-content-head').mouseleave(function () {
    tabProClose()
  });

//头部项目切换模拟 end
  //sortable2
  $('.sortable2').on('click',function () {
    if ($(this).hasClass('desc')) {
      $(this).removeClass('desc')
    }else if($(this).hasClass('asc')){
      $(this).removeClass('asc');
      $(this).addClass('desc');
    }else {
      $(this).addClass('asc');
    }
  });

  window.fiSubLabelWidth = function(element) {
    var widthArrLeft = [];
    var widthArrRight = [];
    function maxNumber (arr){
      var max = arr[0] || 0;
      for (var i = 0; i < arr.length - 1; i++) {
        max = max < arr[i+1] ? arr[i+1] : max
      }
      return max;
    }

    element.find('.fiSub-label').each(function (index) {
      if(index%2 ===0){
        widthArrLeft.push($(this).innerWidth())
      }else {
        widthArrRight.push($(this).innerWidth())
      }
    });

    var MaxWidthArrLeft = maxNumber(widthArrLeft);
    var MaxWidthArrRight = maxNumber(widthArrRight);

    element.find('.fiSub-label').each(function (index) {
      if(index%2 ===0){
        $(this).width(MaxWidthArrLeft+1)
      }else {seo.png
        $(this).width(MaxWidthArrRight+1)
      }
    });

  };
  fiSubLabelWidth ($('.field-submit'));
  $('.tipso').tipso({useTitle: false});
});
